﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class Control_MSDS_Section03View
    Inherits System.Web.UI.UserControl
	Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
#Region "Sub and Function "
	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		If Not IsPostBack Then
			Translate()
			Me.EnableViewState = False
			Dim script As ScriptManager = ScriptManager.GetCurrent(Me.Page)
			If Not script Is Nothing AndAlso script.IsInAsyncPostBack Then
				ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "duyjs", "ajaxJquery()", True)
			Else
				Me.Page.ClientScript.RegisterStartupScript(Me.Page.GetType(), "duyjs", String.Concat("Sys.Application.add_load(function(){", "ajaxJquery()", "});"), True)
			End If
			If Not Request.QueryString("Id").ToString.Equals("0") Then
				hidMSDSID.Value = Request.QueryString("Id")
			End If
			CheckData()
		End If
	End Sub
	Sub CheckData()
		Using data As New VSEntities
			Dim LanguageId = Session("LanguageId").ToString()
			Dim p = (From q In data.MSDSSection03
			   Where q.LanguageId = LanguageId And q.MSDSId = hidMSDSID.Value
			   ).FirstOrDefault()
			If Not p Is Nothing Then
				txtS311.Text = p.S311
				txtS321.Text = p.S321
				txtS331.Text = p.S331
			End If
		End Using
	End Sub
	Protected Sub Translate()
		lbSection03Title.Text = getTranslate("lbSection03Title", Session("LanguageId"), lbSection03Title.Text)
		lblSection03MucXepLoai.Text = getTranslate("lblSection03MucXepLoai", Session("LanguageId"), lblSection03MucXepLoai.Text)
		lblSection03CanhBaoNH.Text = getTranslate("lblSection03CanhBaoNH", Session("LanguageId"), lblSection03CanhBaoNH.Text)
		lblSection03CacDuongTiepXuc.Text = getTranslate("lblSection03CacDuongTiepXuc", Session("LanguageId"), lblSection03CacDuongTiepXuc.Text)
	End Sub
#End Region

End Class
